package com.nimitz.modules.approval.service.impl;


import com.nimitz.modules.approval.domain.ApprovalProcedure;
import com.nimitz.modules.approval.mapper.ApprovalProcedureMapper;
import com.nimitz.modules.approval.service.IApprovalProcedureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @ClassName ApprovalProcedureServiceImpl
 * @Author FuCun
 * @Date 2021-08-17-14:45
 * @PackageName com.nimitz.modules.approval.service.impl
 * @Description 审批流-实现
 * @Version 1.0.0
 */
@Service
public class ApprovalProcedureServiceImpl  implements IApprovalProcedureService {

    @Autowired
    private ApprovalProcedureMapper approvalProcedureMapper;

    /**
     * 查询所有审批流（含搜索）
     *
     * @param  approvalProcedure 审批流
     * @return 审批流集合
     */
    @Override
    public List<ApprovalProcedure> selectApprovalProcedureList(ApprovalProcedure approvalProcedure) {
        return approvalProcedureMapper.selectApprovalProcedureList(approvalProcedure);
    }

    /**
     * 新增审批流信息
     *
     * @param approvalProcedure 审批流
     * @return 结果
     */
    @Override
    public int insertApprovalProcedure(ApprovalProcedure approvalProcedure) {
        return approvalProcedureMapper.insertApprovalProcedure(approvalProcedure);
    }

    /**
     * 修改审批流信息
     *
     * @param approvalProcedure 审批流
     * @return 结果
     */
    @Override
    public int updateApprovalProcedure(ApprovalProcedure approvalProcedure) {
        return approvalProcedureMapper.updateApprovalProcedure(approvalProcedure);
    }

    /**
     * 删除审批流信息
     *
     * @param procedureId 流id
     * @return 结果
     */
    @Override
    public int deleteApprovalProcedureByProcedureId(Long procedureId) {
        return approvalProcedureMapper.deleteApprovalProcedureByProcedureId(procedureId);
    }

    /**
     * 校验审批流名称是否唯一
     *
     * @param procedureName 审批流名称
     * @return 结果
     */
    @Override
    public ApprovalProcedure checkApprovalProcedureNameUnique(String procedureName) {
        return approvalProcedureMapper.checkApprovalProcedureNameUnique(procedureName);
    }
}
